var islogin_data = $.ajax({url:"/site/checklogin",async:false}),islogin_datas = islogin_data.responseText,login_datas = islogin_datas.split("=");
var islogin = login_datas[0],domain = document.domain;
/*var domain_arr = domain.split("."),cmobile_url='m.86sb.com';
if(domain_arr[0]=='www2' && domain_arr[1]=='86sb'){
	//cmobile_url='wap.86sb.com';
	cmobile_url = 'wap'+_endurls;
}else if(domain_arr[0]=='www' && domain_arr[1]=='86sb'){
	//cmobile_url='m.86sb.com';
	cmobile_url = 'm'+_endurls;
}else if(domain_arr[0]=='wap1'){
	//cmobile_url='wap1.'+domain_arr[1]+'.com';
	cmobile_url = 'wap1'+_endurls;
}else if(){
	
}else{
	//cmobile_url='wap.'+domain_arr[1]+'.com';
	cmobile_url = 'wap'+_endurls;
}*/
var c_url = domain,_init_urls = domain_arr[3] && domain_arr[3]=='cn'?'.86sb.com.cn':'.86sb.com',_endurls = domain.replace(domain_arr[0], "");	
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && LowerCase.indexOf("windows nt")<1 && LowerCase.indexOf("macintosh")<1) {
	var cmobile_url = "m.86sb.com";
	if(domain_arr[1]){				
		switch(domain_arr[0]){		
			case 'www2': var cmobile_url='wap'+_endurls; break;
			case 'www3': var cmobile_url='wap'+_endurls; break;
			case 'www4': var cmobile_url='wap'+_endurls; break;
			case 'www5': var cmobile_url='wap'+_endurls; break;
			case 'www':var cmobile_url= (domain_arr[1]!='86sb'?'wap':'m')+_endurls; break;
			case 'wwxs':var cmobile_url='x'+_endurls; break;	
			case 'wap':var cmobile_url='wap'+_endurls;break;
			case 'wap1':var cmobile_url='wap1'+_endurls;break;
			case 'wap2':var cmobile_url='wap2'+_endurls;break;
			case 'wap3':var cmobile_url='wap3'+_endurls;break;
			case 'm':var cmobile_url='m'+_endurls;break;
			case 'x':var cmobile_url='x'+_endurls;break;	
		}
	}
}else {	
	var cmobile_url = "www.86sb.com";	
	if(domain_arr[1]){				
		switch(domain_arr[0]){
			case 'www2': var cmobile_url=(domain_arr[1]!='86sb'?'www':'www2')+_endurls; break;
			case 'www3': var cmobile_url='www3'+_endurls; break;
			case 'www4': var cmobile_url='www4'+_endurls; break;
			case 'www5': var cmobile_url='www5'+_endurls; break;
			case 'www':var cmobile_url='www'+_endurls; break;
			case 'wwxs':var cmobile_url='wwxs'+_endurls; break;		
			case 'wap':var cmobile_url = (domain_arr[1]!='86sb'?'www':'www2')+_endurls;break;
			case 'wap1':var cmobile_url=(domain_arr[1]!='86sb'?'www':'www2')+_endurls;break;
			case 'wap2':var cmobile_url=(domain_arr[1]!='86sb'?'www':'www2')+_endurls;break;
			case 'wap3':var cmobile_url='www3'+_endurls;break;
			case 'm':var cmobile_url='www'+_endurls;break;
			case 'x':var cmobile_url='wwxs'+_endurls;break;
		}
	}	
}

var mobile_url = "http://"+cmobile_url;
var cip ='',cname='',cid = 0;
$.each(returnCitySN,function(name,value) {		
		switch(name){
			case 'cip':cip = value;break;
			case 'cid':cid = value;break;
			case 'cname':cname = value;break;
		}
});

var istrue = true;
 function calltel_init(nums,names,title) {
	var urls = window.location.href,urlsm = document.domain;	 
	if(istrue){	
		istrue = false;
		 $.getJSON("/common/calltel?nums="+nums+"&title="+title+"&uname="+names+"&ip="+cip+"&t="+Math.random()+"&urls="+(window.location.href),function(data){
			istrue = true;
			if(data.status==0){
					alert(data.msg);					
				}					
		 });
	}		
}
function tomobile(url){	
	if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
        window.location = url.length>0?url:"http://"+_amurl+"/"+GetUrlRelativePath(); 
    }else{
		var LowerCase = navigator.userAgent.toLowerCase();
		if(LowerCase.indexOf("windows nt") === -1 && LowerCase.indexOf("macintosh") === -1)
		{
		   window.location.href = url.length>0?url:"http://"+_amurl+"/"+GetUrlRelativePath();
		}
	}	
}

function tomurl(url){	
	if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
        window.location = url.length>0?url:"http://"+_amurl+"/"+GetUrlRelativePath(); 
    }else{
		var LowerCase = navigator.userAgent.toLowerCase();
		if(LowerCase.indexOf("windows nt") === -1 && LowerCase.indexOf("macintosh") === -1)
		{
		   window.location.href = url.length>0?url:"http://"+_amurl+"/"+GetUrlRelativePath();
		}
	}	
}

function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}

function returnQueryString(name,urls)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = urls.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
